Skip to content

Conversation

teunbrand
Copy link
Collaborator

This PR aims to fix #6622 and fix #6638.

Essentially, whenever an expression label comes in, we pack it as a list. In the drawing methods of GeomText and GeomLabel we unpack the list back to expressions. This way, expressions survive internals.

labels <- lapply(labels, `[`, i)
}
if (is.expression(label)) {
label <- unclass(as.list(label))
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The unclass() idea is from #6639.
It counters length 1 expression subclasses, which is admittedly a niche problem.

@teunbrand teunbrand added this to the ggplot2 4.0.1 milestone Oct 7, 2025
@thomasp85
Copy link
Member

I think there is a small bug but otherwise LGTM

@teunbrand teunbrand merged commit d262ffb into tidyverse:main Oct 20, 2025
13 checks passed
@teunbrand teunbrand deleted the expression_aesthetics branch October 20, 2025 08:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

expressions as tick label broken expressions as annotations broken

2 participants